#region license
# This file is part of Grawlix.
# 
# Grawlix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# 
# Grawlix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with Grawlix.  If not, see
# <http://www.gnu.org/licenses/>.
#endregion

"""Typed valuetype equality testing."""

namespace Grawlix.Meta.Tests.Equality
import Grawlix.Meta
import NUnit.Framework
import System

[TestFixture]
class TypedValueEqualityFixture(EqualityAttributeTestCase):


#region w
	
	[Test]
	def EqualsW():
		expect w, \
			not	_.Equals(a), \
			not	_.Equals(b), \
			not	_.Equals(c), \
				_.Equals(d), \
				_.Equals(w), \
			not	_.Equals(x), \
			not	_.Equals(y), \
				_.Equals(z), \
			not	_.Equals(aN), \
			not	_.Equals(bN), \
			not	_.Equals(cN), \
			not	_.Equals(dN), \
			not	_.Equals(aO), \
			not	_.Equals(bO), \
			not	_.Equals(cO), \
				_.Equals(dO), \
				_.Equals(wO), \
			not	_.Equals(xO), \
			not	_.Equals(yO), \
				_.Equals(zO), \
			not	_.Equals(oN), \
				_.Equals(wE), \
			not	_.Equals(null)
		# See BOO-1061
		expect NullReferenceException:
			expect w, not _.Equals(wU)
	
	[Test]
	def EqualOperatorW():
		expect w, \
				_ == a, \
			not	_ == b, \
				_ == c, \
				_ == d, \
				_ == w, \
			not	_ == x, \
			not	_ == y, \
				_ == z, \
			not	_ == aN, \
			not	_ == bN, \
			not	_ == cN, \
			not	_ == dN, \
				_ == aO, \
			not	_ == bO, \
				_ == cO, \
				_ == dO, \
				_ == wO, \
			not	_ == xO, \
			not	_ == yO, \
				_ == zO, \
			not	_ == oN, \
				_ == wE, \
			not	_ == wU, \
			not	_ == null
	
	[Test]
	def NotEqualOperatorW():
		expect w, \
			not	_ != a, \
				_ != b, \
			not	_ != c, \
			not	_ != d, \
			not	_ != w, \
				_ != x, \
				_ != y, \
			not	_ != z, \
				_ != aN, \
				_ != bN, \
				_ != cN, \
				_ != dN, \
			not	_ != aO, \
				_ != bO, \
			not	_ != cO, \
			not	_ != dO, \
			not	_ != wO, \
				_ != xO, \
				_ != yO, \
			not	_ != zO, \
				_ != oN, \
			not	_ != wE, \
				_ != wU, \
				_ != null

#endregion


#region x
	
	[Test]
	def EqualsX():
		expect x, \
			not	_.Equals(a), \
			not	_.Equals(b), \
			not	_.Equals(c), \
			not	_.Equals(d), \
			not	_.Equals(w), \
				_.Equals(x), \
			not	_.Equals(y), \
			not	_.Equals(z), \
			not	_.Equals(aN), \
			not	_.Equals(bN), \
			not	_.Equals(cN), \
			not	_.Equals(dN), \
			not	_.Equals(aO), \
			not	_.Equals(bO), \
			not	_.Equals(cO), \
			not	_.Equals(dO), \
			not	_.Equals(wO), \
				_.Equals(xO), \
			not	_.Equals(yO), \
			not	_.Equals(zO), \
			not	_.Equals(oN), \
				_.Equals(xE), \
			not	_.Equals(null)
		# See BOO-1061
		expect NullReferenceException:
			expect x, not _.Equals(xU)
	
	[Test]
	def EqualOperatorX():
		expect x, \
			not	_ == a, \
			not	_ == b, \
			not	_ == c, \
			not	_ == d, \
			not	_ == w, \
				_ == x, \
			not	_ == y, \
			not	_ == z, \
			not	_ == aN, \
			not	_ == bN, \
			not	_ == cN, \
			not	_ == dN, \
			not	_ == aO, \
			not	_ == bO, \
			not	_ == cO, \
			not	_ == dO, \
			not	_ == wO, \
				_ == xO, \
			not	_ == yO, \
			not	_ == zO, \
			not	_ == oN, \
				_ == xE, \
			not	_ == xU
	
	[Test]
	def NotEqualOperatorX():
		expect x, \
				_ != a, \
				_ != b, \
				_ != c, \
				_ != d, \
				_ != w, \
			not	_ != x, \
				_ != y, \
				_ != z, \
				_ != aN, \
				_ != bN, \
				_ != cN, \
				_ != dN, \
				_ != aO, \
				_ != bO, \
				_ != cO, \
				_ != dO, \
				_ != wO, \
			not	_ != xO, \
				_ != yO, \
				_ != zO, \
				_ != oN, \
			not	_ != xE, \
				_ != xU

#endregion

#region y
	
	[Test]
	def EqualsY():
		expect y, \
				_.Equals(a), \
			not	_.Equals(b), \
			not	_.Equals(c), \
			not	_.Equals(d), \
			not	_.Equals(w), \
			not	_.Equals(x), \
			/* Value-type reference equality */ \
			not	_.Equals(y), \
			not	_.Equals(z), \
			not	_.Equals(aN), \
			not	_.Equals(bN), \
			not	_.Equals(cN), \
			not	_.Equals(dN), \
				_.Equals(aO), \
			not	_.Equals(bO), \
			not	_.Equals(cO), \
			not	_.Equals(dO), \
			not	_.Equals(wO), \
			not	_.Equals(xO), \
			/* Value-type reference equality */ \
			not	_.Equals(yO), \
			not	_.Equals(zO), \
			not	_.Equals(oN), \
			not	_.Equals(null)
	
	[Test]
	def EqualOperatorY():
		expect y, \
				_ == a, \
			not	_ == b, \
			not	_ == c, \
			not	_ == d, \
			not	_ == w, \
			not	_ == x, \
			/* Value-type reference equality */ \
			not	_ == y, \
			not	_ == z, \
			not	_ == aN, \
			not	_ == bN, \
			not	_ == cN, \
			not	_ == dN, \
				_ == aO, \
			not	_ == bO, \
			not	_ == cO, \
			not	_ == dO, \
			not	_ == wO, \
			not	_ == xO, \
			/* Value-type reference equality */ \
			not	_ == yO, \
			not	_ == zO, \
			not	_ == oN, \
			not	_ == null
	
	[Test]
	def NotEqualOperatorY():
		expect y, \
			not	_ != a, \
				_ != b, \
				_ != c, \
				_ != d, \
				_ != w, \
				_ != x, \
			/* Value-type reference equality */ \
				_ != y, \
				_ != z, \
				_ != aN, \
				_ != bN, \
				_ != cN, \
				_ != dN, \
			not	_ != aO, \
				_ != bO, \
				_ != cO, \
				_ != dO, \
				_ != wO, \
				_ != xO, \
			/* Value-type reference equality */ \
				_ != yO, \
				_ != zO, \
				_ != oN, \
				_ != null

#endregion

#region z
	
	[Test]
	def EqualsZ():
		expect z, \
			not	_.Equals(a), \
			not	_.Equals(b), \
			not	_.Equals(c), \
			not	_.Equals(d), \
			not	_.Equals(w), \
			not	_.Equals(x), \
			not	_.Equals(y), \
			/* Primitive equality */ \
				_.Equals(z), \
			not	_.Equals(aN), \
			not	_.Equals(bN), \
			not	_.Equals(cN), \
			not	_.Equals(dN), \
			not	_.Equals(aO), \
			not	_.Equals(bO), \
			not	_.Equals(cO), \
			not	_.Equals(dO), \
			not	_.Equals(wO), \
			not	_.Equals(xO), \
			not	_.Equals(yO), \
			/* Primitive equality */ \
				_.Equals(zO), \
			not	_.Equals(oN), \
			not	_.Equals(null)
	
	[Test]
	def EqualOperatorZ():
		expect z, \
				_ == a, \
			not	_ == b, \
			not	_ == c, \
			not	_ == d, \
				_ == w, \
			not	_ == x, \
			not	_ == y, \
			/* Primitive equality */ \
				_ == z, \
			not	_ == aN, \
			not	_ == bN, \
			not	_ == cN, \
			not	_ == dN, \
				_ == aO, \
			not	_ == bO, \
			not	_ == cO, \
			not	_ == dO, \
				_ == wO, \
			not	_ == xO, \
			not	_ == yO, \
			/* Primitive equality */ \
				_ == zO, \
			not	_ == oN
	
	[Test]
	def NotEqualOperatorZ():
		expect z, \
			not	_ != a, \
				_ != b, \
				_ != c, \
				_ != d, \
			not	_ != w, \
				_ != x, \
				_ != y, \
			/* Primitive equality */ \
			not	_ != z, \
				_ != aN, \
				_ != bN, \
				_ != cN, \
				_ != dN, \
			not	_ != aO, \
				_ != bO, \
				_ != cO, \
				_ != dO, \
			not	_ != wO, \
				_ != xO, \
				_ != yO, \
			/* Primitive equality */ \
			not	_ != zO, \
				_ != oN

#endregion
